Debian 8 Jessie
Sponsored Link

Basic Auth+PAM
2015/05/18
 
Limit accesses on specific web pages and use OS users for authentication with SSL connection.
[1]
[2] For example, set Basic Auth under the [/var/www/html/auth-pam] directory.
root@www:~#
aptitude -y install libapache2-mod-authnz-external pwauth
root@www:~#
mkdir /var/www/html/auth-pam

root@www:~#
vi /etc/apache2/sites-available/auth-pam.conf
# create new

AddExternalAuth pwauth /usr/sbin/pwauth
SetExternalAuthMethod pwauth pipe
<Directory /var/www/html/auth-pam>
    SSLRequireSSL
    AuthType Basic
    AuthName "PAM Authentication"
    AuthBasicProvider external
    AuthExternal pwauth
    require valid-user
</Directory>

root@www:~#
a2ensite auth-pam

Enabling site auth-pam.
To activate the new configuration, you need to run:
  service apache2 reload

root@www:~#
systemctl restart apache2
# create a test page

root@www:~#
vi /var/www/html/auth-pam/index.html
<html>
<body>
<div style="width: 100%; font-size: 40px; font-weight: bold; text-align: center;">
Test Page for PAM Auth
</div>
</body>
</html>
  Access to the test page with a Web browser on Client and authenticate with a user which is on OS.
  Just accessed.
 
Tweet